<?php

namespace app\common\lib\astrolog;

/**
 * All options for astrolabe data
 * Class Options
 * @author g18511696867@gmail.com
 * @package app\common\lib\astrolog
 */
class Options
{
    const PLANET_NOON = -1;
    const PLANET_SUN = 0;
    const PLANET_MOON = 1;
    const PLANET_MERC = 2;
    const PLANET_VENU = 3;
    const PLANET_MARS = 4;
    const PLANET_JUPI = 5;
    const PLANET_SATU = 6;
    const PLANET_URAN = 7;
    const PLANET_NEPT = 8;
    const PLANET_PLUT = 9;
    const PLANET_CHIR = 10;
    const PLANET_LILI = 11;
    const PLANET_NON = 12;
    const PLANET_JUNO = 13;
    const PLANET_FORT = 14;
    const PLANET_VERT = 15;
    const PLANET_SON = 16;
    const PLANET_ASC = 17;
    const PLANET_IC = 18;
    const PLANET_DES = 19;
    const PLANET_MC = 20;

    const SIGN_ARI = 1;
    const SIGN_TOU = 2;
    const SIGN_GEM = 3;
    const SIGN_CAN = 4;
    const SIGN_LEO = 5;
    const SIGN_VIR = 6;
    const SIGN_LIB = 7;
    const SIGN_SCO = 8;
    const SIGN_SAG = 9;
    const SIGN_CAP = 10;
    const SIGN_AQU = 11;
    const SIGN_PIS = 12;

    const HOUSE_1 = 1;
    const HOUSE_2 = 2;
    const HOUSE_3 = 3;
    const HOUSE_4 = 4;
    const HOUSE_5 = 5;
    const HOUSE_6 = 6;
    const HOUSE_7 = 7;
    const HOUSE_8 = 8;
    const HOUSE_9 = 9;
    const HOUSE_10 = 10;
    const HOUSE_11 = 11;
    const HOUSE_12 = 12;

    const PHASE_0 = 0;
    const PHASE_30 = 30;
    const PHASE_45 = 45;
    const PHASE_60 = 60;
    const PHASE_72 = 72;
    const PHASE_90 = 90;
    const PHASE_120 = 120;
    const PHASE_135 = 135;
    const PHASE_144 = 144;
    const PHASE_150 = 150;
    const PHASE_180 = 180;

    const ARABIC_SPIRIT = 0;
    const ARABIC_EROS = 1;
    const ARABIC_VICTORY = 2;
    const ARABIC_NECESSITY = 3;
    const ARABIC_COURAGE = 4;
    const ARABIC_NEMESIS = 5;
    const ARABIC_EXALTATION = 6;
    const ARABIC_BASE = 7;
    const ARABIC_SYZYGY = 8;

    /**
     * Defined all of the planet use in chart
     */
    const ALL_PLANETS = [
        self::PLANET_SUN, self::PLANET_MOON, self::PLANET_MERC, self::PLANET_VENU, self::PLANET_MARS, self::PLANET_JUPI, self::PLANET_SATU,
        self::PLANET_URAN, self::PLANET_NEPT, self::PLANET_PLUT, self::PLANET_CHIR, self::PLANET_LILI, self::PLANET_NON, self::PLANET_JUNO,
        self::PLANET_FORT, self::PLANET_VERT, self::PLANET_SON, self::PLANET_ASC, self::PLANET_IC, self::PLANET_DES, self::PLANET_MC
    ];

    /**
     * Defined all of the ancient planet
     */
    const ANCIENT_PLANETS = [self::PLANET_SUN, self::PLANET_MOON, self::PLANET_MERC, self::PLANET_VENU, self::PLANET_MARS, self::PLANET_JUPI, self::PLANET_SATU];

    /**
     * Defined all of the phase system used.
     */
    const ALL_PHASES = [
        self::PHASE_0, self::PHASE_30, self::PHASE_45, self::PHASE_60, self::PHASE_72, self::PHASE_90,
        self::PHASE_120, self::PHASE_135, self::PHASE_144, self::PHASE_150, self::PHASE_180
    ];

    /**
     * Defined all of the arabics use in chart
     * expect fortune because of fortune use in planet.
     */
    const ALL_ARABICS = [
        self::ARABIC_SPIRIT, self::ARABIC_EROS, self::ARABIC_VICTORY, self::ARABIC_NECESSITY, self::ARABIC_COURAGE,
        self::ARABIC_NEMESIS, self::ARABIC_EXALTATION, self::ARABIC_BASE, self::ARABIC_SYZYGY
    ];

    /**
     * Defined all of the house systems
     * 0 p Placidus
     * 1 k Koch
     * 2 r Regiomontanus
     * 3 c Campanus
     * 4 b Alcabitus
     * 5 o Porphyrius
     * 6 m Morinus
     * 7 a Equal
     * 8 t Topocentric
     * 9 v Vehlow
     * 10 w Whole
     */
    const HOUSE_SYSTEMS = ['p', 'k', 'r', 'c', 'b', 'o', 'm', 'a', 't', 'v', 'w'];
//    A  equal      均分制:从上升点开始每30度一宫。
//    B  Alcabitius     阿卡比特司宫位制:以上升点到中天的赤经三等份，投影到黄道上为10，11，12宫；以下降点到天底的赤经三等分，投影到黄道上形成1，2，3宫。
//    C  Campanus
//    D  equal / MC
//    E  equal = A
//    F  Carter poli-equatorial
//    G  36 Gauquelin sectors
//    H  horizon / azimuth
//    I  Sunshine
//    i  Sunshine alternative
//    K  Koch               科赫宫位制:为普拉西德系统的延伸
//    L  Pullen S-delta
//    M  Morinus
//    N  Whole sign, Aries = 1st house
//    O  Porphyry
//    P  Placidus           普拉西德宫位制:当前西方占星术最通用的系统，是按时间而不是空间分配。只适用于南北纬66度之间。
//    Q  Pullen S-ratio
//    R  Regiomontanus  芮吉欧蒙塔那司宫位制:天赤道均分12份，以地平南北为轴点投影到黄道上。
//    S  Sripati
//    T  Polich/Page ("topocentric")
//    U  Krusinski-Pisa-Goelzer
//    V  equal Vehlow
//    W  equal, whole sign  整宫制:每星座正对一个宫位。此为最古老的系统。
//    X  axial rotation system/ Meridian houses
//    Y  APC houses


    /**
     * Defined all of planet charge years by Chaldean order
     * The so-called Chaldean Order of Planets is Saturn, Jupiter, Mars, Sun, Venus, Mercury, Moon.
     */
    const FIRDARIA_PLANET_YEARS = [
        self::PLANET_SUN => 10, self::PLANET_MOON => 9, self::PLANET_MERC => 13, self::PLANET_VENU => 8, self::PLANET_MARS => 7,
        self::PLANET_JUPI => 12, self::PLANET_SATU => 11, self::PLANET_NON => 3, self::PLANET_SON => 2,
    ];

    /**
     * Defined firdaria main
     * people born in the day.
     */
    const FIRDARIA_MAIN_DAY = [
        self::PLANET_SUN, self::PLANET_VENU, self::PLANET_MERC, self::PLANET_MOON, self::PLANET_SATU, self::PLANET_JUPI, self::PLANET_MARS, self::PLANET_NON, self::PLANET_SON,
    ];

    /**
     * Defined firdaria main
     * people born in the night.
     */
    const FIRDARIA_MAIN_NIGHT = [
        [self::PLANET_MOON, self::PLANET_SATU, self::PLANET_JUPI, self::PLANET_MARS, self::PLANET_NON, self::PLANET_SON, self::PLANET_SUN, self::PLANET_VENU, self::PLANET_MERC],
        [self::PLANET_MOON, self::PLANET_SATU, self::PLANET_JUPI, self::PLANET_MARS, self::PLANET_SUN, self::PLANET_VENU, self::PLANET_MERC, self::PLANET_NON, self::PLANET_SON],
    ];

    /**
     * Defined firdaria sub
     * there is double for calculate.
     */
    const FIRDARIA_SUB = [
        self::PLANET_SUN, self::PLANET_VENU, self::PLANET_MERC, self::PLANET_MOON, self::PLANET_SATU, self::PLANET_JUPI, self::PLANET_MARS,
        self::PLANET_SUN, self::PLANET_VENU, self::PLANET_MERC, self::PLANET_MOON, self::PLANET_SATU, self::PLANET_JUPI, self::PLANET_MARS,
    ];

    /**
     * There is the speed for planet [0,6] by day
     * else use 0.
     */
    const PLANETS_SPEED = [
        self::PLANET_SUN => 0.9855555555555555, self::PLANET_MOON => 13.176666666666666, self::PLANET_MERC => 0.9855555555555555, self::PLANET_VENU => 0.9855555555555555,
        self::PLANET_MARS => 0.5241666666666667, self::PLANET_JUPI => 0.08305555555555556, self::PLANET_SATU => 0.03638888888888889,
    ];

    /**
     * Defined the sign wall planet
     * power +5  it's planet in cross sign power -5
     */
    const WALLS = [
        1 => self::PLANET_MARS, 2 => self::PLANET_VENU, 3 => self::PLANET_MERC, 4 => self::PLANET_MOON, 5 => self::PLANET_SUN, 6 => self::PLANET_MERC,
        7 => self::PLANET_VENU, 8 => self::PLANET_MARS, 9 => self::PLANET_JUPI, 10 => self::PLANET_SATU, 11 => self::PLANET_SATU, 12 => self::PLANET_JUPI
    ];

    /**
     * Defined the sign promote planet
     * first check the planet not be -1
     * power +4  it's planet in cross sign power -4
     */
    const PROMOTE = [
        1 => self::PLANET_SUN, 2 => self::PLANET_MOON, 3 => self::PLANET_NOON, 4 => self::PLANET_JUPI, 5 => self::PLANET_NOON, 6 => self::PLANET_MERC,
        7 => self::PLANET_SATU, 8 => self::PLANET_NOON, 9 => self::PLANET_NOON, 10 => self::PLANET_MARS, 11 => self::PLANET_NOON, 12 => self::PLANET_VENU
    ];

    /**
     * Defined the sign trisection planet
     * power +3
     * key 0 is day
     * key 1 is night
     * key 2 is public
     */
    const TRISECTION = [
        1 => [self::PLANET_SUN, self::PLANET_JUPI, self::PLANET_SATU],
        2 => [self::PLANET_VENU, self::PLANET_MOON, self::PLANET_MARS],
        3 => [self::PLANET_SATU, self::PLANET_MERC, self::PLANET_JUPI],
        4 => [self::PLANET_VENU, self::PLANET_MARS, self::PLANET_MOON],
        5 => [self::PLANET_SUN, self::PLANET_JUPI, self::PLANET_SATU],
        6 => [self::PLANET_VENU, self::PLANET_MOON, self::PLANET_MARS],
        7 => [self::PLANET_SATU, self::PLANET_MERC, self::PLANET_JUPI],
        8 => [self::PLANET_VENU, self::PLANET_MARS, self::PLANET_MOON],
        9 => [self::PLANET_SUN, self::PLANET_JUPI, self::PLANET_SATU],
        10 => [self::PLANET_VENU, self::PLANET_MOON, self::PLANET_MARS],
        11 => [self::PLANET_SATU, self::PLANET_MERC, self::PLANET_JUPI],
        12 => [self::PLANET_VENU, self::PLANET_MARS, self::PLANET_MOON],
    ];

    /**
     * Defined all of bounds
     * power +2
     * 0 egyptian
     * 1 ptolemaic
     * there is bounds for 12 signs.
     * the smallest array key 0 was planet id
     * and key 1 is the degree be in charge of sign.
     */
    const BOUNDS = [
        [
            1 => [[self::PLANET_JUPI, 6], [self::PLANET_VENU, 6], [self::PLANET_MERC, 8], [self::PLANET_MARS, 5], [self::PLANET_SATU, 5]],
            2 => [[self::PLANET_VENU, 8], [self::PLANET_MERC, 6], [self::PLANET_JUPI, 8], [self::PLANET_SATU, 5], [self::PLANET_MARS, 3]],
            3 => [[self::PLANET_MERC, 6], [self::PLANET_JUPI, 6], [self::PLANET_VENU, 5], [self::PLANET_MARS, 7], [self::PLANET_SATU, 6]],
            4 => [[self::PLANET_MARS, 7], [self::PLANET_VENU, 6], [self::PLANET_MERC, 6], [self::PLANET_JUPI, 7], [self::PLANET_SATU, 4]],
            5 => [[self::PLANET_JUPI, 6], [self::PLANET_VENU, 5], [self::PLANET_SATU, 7], [self::PLANET_MERC, 6], [self::PLANET_MARS, 6]],
            6 => [[self::PLANET_MERC, 7], [self::PLANET_VENU, 10], [self::PLANET_JUPI, 4], [self::PLANET_MARS, 7], [self::PLANET_SATU, 2]],
            7 => [[self::PLANET_SATU, 6], [self::PLANET_MERC, 8], [self::PLANET_JUPI, 7], [self::PLANET_VENU, 7], [self::PLANET_MARS, 2]],
            8 => [[self::PLANET_MARS, 7], [self::PLANET_VENU, 4], [self::PLANET_MERC, 8], [self::PLANET_JUPI, 5], [self::PLANET_SATU, 6]],
            9 => [[self::PLANET_JUPI, 12], [self::PLANET_VENU, 5], [self::PLANET_MERC, 4], [self::PLANET_SATU, 5], [self::PLANET_MARS, 4]],
            10 => [[self::PLANET_MERC, 7], [self::PLANET_JUPI, 7], [self::PLANET_VENU, 8], [self::PLANET_SATU, 4], [self::PLANET_MARS, 4]],
            11 => [[self::PLANET_MERC, 7], [self::PLANET_VENU, 6], [self::PLANET_JUPI, 7], [self::PLANET_MARS, 5], [self::PLANET_SATU, 5]],
            12 => [[self::PLANET_VENU, 12], [self::PLANET_JUPI, 4], [self::PLANET_MERC, 3], [self::PLANET_MARS, 9], [self::PLANET_SATU, 2]]
        ],
        [
            1 => [[self::PLANET_JUPI, 6], [self::PLANET_VENU, 8], [self::PLANET_MERC, 7], [self::PLANET_MARS, 5], [self::PLANET_SATU, 4]],
            2 => [[self::PLANET_VENU, 8], [self::PLANET_MERC, 7], [self::PLANET_JUPI, 5], [self::PLANET_SATU, 4], [self::PLANET_MARS, 4]],
            3 => [[self::PLANET_MERC, 7], [self::PLANET_JUPI, 6], [self::PLANET_VENU, 7], [self::PLANET_MARS, 6], [self::PLANET_SATU, 4]],
            4 => [[self::PLANET_MARS, 6], [self::PLANET_JUPI, 7], [self::PLANET_MERC, 7], [self::PLANET_VENU, 7], [self::PLANET_SATU, 4]],
            5 => [[self::PLANET_SATU, 6], [self::PLANET_MERC, 7], [self::PLANET_VENU, 6], [self::PLANET_JUPI, 6], [self::PLANET_MARS, 5]],
            6 => [[self::PLANET_MERC, 7], [self::PLANET_VENU, 6], [self::PLANET_JUPI, 5], [self::PLANET_SATU, 6], [self::PLANET_MARS, 6]],
            7 => [[self::PLANET_SATU, 6], [self::PLANET_VENU, 5], [self::PLANET_JUPI, 8], [self::PLANET_MERC, 5], [self::PLANET_MARS, 6]],
            8 => [[self::PLANET_MARS, 6], [self::PLANET_JUPI, 8], [self::PLANET_VENU, 7], [self::PLANET_MERC, 6], [self::PLANET_SATU, 3]],
            9 => [[self::PLANET_JUPI, 8], [self::PLANET_VENU, 6], [self::PLANET_MERC, 5], [self::PLANET_SATU, 6], [self::PLANET_MARS, 5]],
            10 => [[self::PLANET_VENU, 6], [self::PLANET_MERC, 6], [self::PLANET_JUPI, 7], [self::PLANET_MARS, 6], [self::PLANET_SATU, 5]],
            11 => [[self::PLANET_SATU, 6], [self::PLANET_MERC, 6], [self::PLANET_VENU, 8], [self::PLANET_JUPI, 5], [self::PLANET_MARS, 5]],
            12 => [[self::PLANET_VENU, 8], [self::PLANET_JUPI, 6], [self::PLANET_MERC, 6], [self::PLANET_MARS, 6], [self::PLANET_SATU, 4]]
        ]
    ];

    /**
     * Defined all of decanates
     * power +1
     * 0 European
     * 1 India
     * there is decanates for 12 signs.
     * the smallest array key 0 is planet id for [0,10)
     *                and key 1 is planet id for [10,20)
     *                and key 2 is planet id for [20,30)
     */
    const DECANATES = [
        [
            1 => [self::PLANET_MARS, self::PLANET_SUN, self::PLANET_VENU],
            2 => [self::PLANET_MERC, self::PLANET_MOON, self::PLANET_SATU],
            3 => [self::PLANET_JUPI, self::PLANET_MARS, self::PLANET_SUN],
            4 => [self::PLANET_VENU, self::PLANET_MERC, self::PLANET_MOON],
            5 => [self::PLANET_SATU, self::PLANET_JUPI, self::PLANET_MARS],
            6 => [self::PLANET_SUN, self::PLANET_VENU, self::PLANET_MERC],
            7 => [self::PLANET_MOON, self::PLANET_SATU, self::PLANET_JUPI],
            8 => [self::PLANET_MARS, self::PLANET_SUN, self::PLANET_VENU],
            9 => [self::PLANET_MERC, self::PLANET_MOON, self::PLANET_SATU],
            10 => [self::PLANET_JUPI, self::PLANET_MARS, self::PLANET_SUN],
            11 => [self::PLANET_VENU, self::PLANET_MERC, self::PLANET_MOON],
            12 => [self::PLANET_SATU, self::PLANET_JUPI, self::PLANET_MARS],
        ],
        [
            1 => [self::PLANET_MARS, self::PLANET_SUN, self::PLANET_JUPI],
            2 => [self::PLANET_VENU, self::PLANET_MERC, self::PLANET_SATU],
            3 => [self::PLANET_MERC, self::PLANET_VENU, self::PLANET_SATU],
            4 => [self::PLANET_MOON, self::PLANET_MARS, self::PLANET_JUPI],
            5 => [self::PLANET_SUN, self::PLANET_JUPI, self::PLANET_MARS],
            6 => [self::PLANET_MERC, self::PLANET_SATU, self::PLANET_VENU],
            7 => [self::PLANET_VENU, self::PLANET_SATU, self::PLANET_MERC],
            8 => [self::PLANET_MARS, self::PLANET_JUPI, self::PLANET_MOON],
            9 => [self::PLANET_JUPI, self::PLANET_MARS, self::PLANET_SUN],
            10 => [self::PLANET_SATU, self::PLANET_VENU, self::PLANET_MOON],
            11 => [self::PLANET_SATU, self::PLANET_MERC, self::PLANET_VENU],
            12 => [self::PLANET_JUPI, self::PLANET_MOON, self::PLANET_MARS],
        ]
    ];

    /**
     * Defined the planet procted the sign from 1 to 12 (morden)
     */
    const PROTECT_ID = [
        1 => self::PLANET_MARS, 2 => self::PLANET_VENU, 3 => self::PLANET_MERC, 4 => self::PLANET_MOON, 5 => self::PLANET_SUN, 6 => self::PLANET_MERC,
        7 => self::PLANET_VENU, 8 => self::PLANET_PLUT, 9 => self::PLANET_JUPI, 10 => self::PLANET_SATU, 11 => self::PLANET_URAN, 12 => self::PLANET_NEPT
    ];

    /**
     * Defined the planet procted the sign from 1 to 12 (ancient)
     */
    const PROTECT_ID_ANCIENT = [
        1 => self::PLANET_MARS, 2 => self::PLANET_VENU, 3 => self::PLANET_MERC, 4 => self::PLANET_MOON, 5 => self::PLANET_SUN, 6 => self::PLANET_MERC,
        7 => self::PLANET_VENU, 8 => self::PLANET_MARS, 9 => self::PLANET_JUPI, 10 => self::PLANET_SATU, 11 => self::PLANET_SATU, 12 => self::PLANET_JUPI
    ];

    /**
     * Default bound use egyptian
     * @var int (0|1)
     */
    protected static $bound = 0;

    /**
     * Default ayanamsa is none
     * 1 Fagan-Bradley
     * 2 Lahiri
     * 3 Deluce
     * 4 Raman
     * 5 Ushashashi
     * 6 Krishnamurti
     * 7 DjwhalKhul
     * 8 Yukteshwar
     * 9 JNBhasin
     * 10 Babylonian, Kugler I
     * 11 Babylonian, Kugler II
     * 12 Babylonian, Kugler III
     * 13 Babylonian, Huber
     * 14 Babylonian, Mercier
     * 15 Aldebaran 15 Taurus
     * 16 Hipparchos
     * 17 Sassanian
     * 18 Galactic Center at 0 Sag
     * 19 J2000
     * 20 J1900
     * 21 B1950
     * @var int
     */
    protected static $ayanamsa = 0;

    /**
     * Default housesystem use Placidus
     * @var int
     */
    protected static $hsys = 0;

    /**
     * Default for born in night people firdaria main
     * @var int
     */
    protected static $firdaria = 0;

    /**
     * Defined the default of Zodiac
     * 0 Tropical Zodiac
     * 1 Sidereal Zodiac
     * @var int
     */
    protected static $ecliptic = 0;

    /**
     * Defined the default of profection moon push direction
     * 0 counterclockwise
     * 1 clockwise
     * @var int
     */
    protected static $profection = 0;

    /**
     * Defined the default of decanates configuration
     * 0 European
     * 1 India
     * @var int
     */
    protected static $decanates = 0;

    /**
     * Defined the planet orb using or not
     * 0 using
     * 1 nonuse
     * @var int
     */
    protected static $planetOrbUse = 0;

    /**
     * Defined the phase orb using or not
     * 0 using
     * 1 nonuse
     * @var int
     */
    protected static $phaseOrbUse = 0;

    /**
     * Defined the arabic orb using or not
     * 0 using
     * 1 nonuse
     * @var int
     */
    protected static $arabicOrbUse = 0;

    /**
     * Defined the planets display or hide
     * true display
     * false hide
     * @var array
     */
    protected static $planets = [true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false];

    /**
     * Defined the phases display or hide
     * true display
     * false hide
     * @var array
     */
    protected static $phases = [true, false, false, true, false, true, true, false, false, false, true];

    /**
     * Defined the arabics display or hide
     * true display
     * false hide
     * @var array
     */
    protected static $arabics = [false, false, false, false, false, false, false, false, false];

    /**
     * Defined the planets orb used
     * float
     * @var array
     */
    protected static $planetOrbs = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];

    /**
     * Defined the phases orb used
     * float
     * @var array
     */
    protected static $phaseOrbs = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];

    /**
     * Defined the arabics orb used
     * float
     * @var array
     */
    protected static $arabicOrbs = [0, 0, 0, 0, 0, 0, 0, 0, 0];

    /**
     * Defined Whether or not to get characteristic data
     * 0 not
     * 1 get
     * @var int
     */
    protected static $getCharacteristic = 0;

    /**
     * Defined Whether or not to get fortune score data
     * 0 not
     * 1 get
     * @var int
     */
    protected static $getFortuneScore = 0;

    /**
     * Defined Whether or not to get house power distribution data
     * [ angular ,continues ,apoklimas]
     * 0 not
     * 1 get
     * @var int
     */
    protected static $getHousepowerDistribution = 0;

    /**
     * Defined Whether or not to get star data
     * 0 not
     * 1 get
     * @var int
     */
    protected static $getStar = 0;

    /**
     * Defined Whether or not to get structure data
     * 0 not
     * 1 get
     * @var int
     */
    protected static $getStructure = 0;

    /**
     * Defiend Whether or not get arabic data
     * 0 not
     * 1 get
     * @var int
     */
    protected static $getArabic = 0;

    /**
     * Defined the data format for astrolabe or logic calculate
     * 0 astrolabe  Easier for client (ios|adnroid) use.
     * 1 logic  Easier to calculate logically.
     * @var int
     */
    protected static $isLogic = 0;

    /**
     * Configuration Initialize
     * @param array $options
     * @return bool
     */
    public static function init($options = [])
    {
        if (isset($options['planets_display']) && is_string($options['planets_display']) && strlen($options['planets_display']) === 21)
        {
            // "planets_display":"111111111100100001001" Old data
            foreach (self::ALL_PLANETS as $k => $v)
            {
                if (isset($options['planets_display'][$k]))
                {
                    self::$planets[$k] = (int)$options['planets_display'][$k] === 1;
                }
            }
        }

        if (isset($options['asps_display']) && is_array($options['asps_display']))
        {
            // "asps_display":[0,60,90,120,180] Old data
            foreach (self::ALL_PHASES as $k => $v)
            {
                self::$phases[$k] = in_array($v, $options['asps_display']);
            }
        }

        if (isset($options['planet_orb_all']) && is_array($options['planet_orb_all']))
        {
            // "planet_orb_all":[0,0,0,0,0,0,0,0,0,0] Old data
            foreach ($options['planet_orb_all'] as $k => $v)
            {
                if (isset(self::$planetOrbs[$k]))
                {
                    self::$planetOrbs[$k] = (float)$v[1];
                }
            }
        }

        if (isset($options['asp_orb_all']) && is_array($options['asp_orb_all']))
        {
            // "asp_orb_all":{"0":8,"60":6,"90":7,"120":7,"180":7,"30":1,"150":2,"45":2,"135":2,"72":2,"144":2}  Old data
            foreach ($options['asp_orb_all'] as $k => $v)
            {
                if (isset(self::$phaseOrbs[$k]))
                {
                    self::$phaseOrbs[$k] = (float)$v[1];
                }
            }
        }

        if (isset($options['tid']))
        {
            switch ((int)$options['tid'])
            {
                case 2:
                    self::$planetOrbUse = 1;
                    self::$arabicOrbUse = 1;
                    self::$phaseOrbs = 0;
                    break;
                case 3:
                    self::$planetOrbUse = 1;
                    self::$arabicOrbUse = 1;
                    self::$phaseOrbs = 1;
                    break;
                default:
                    self::$planetOrbUse = 0;
                    self::$arabicOrbUse = 0;
                    self::$phaseOrbs = 1;
                    break;
            }
        }

        if (isset($options['planet']) && !empty($options['planet']))
        {
            foreach ($options['planet'] as $k => $v)
            {
                if (isset(self::$planets[$k]))
                {
                    self::$planets[$k] = $v[0] ? true : false;

                    if (self::$planetOrbUse === 1)
                    {
                        self::$planetOrbs[$k] = (float)$v[1];
                    }
                }
            }
        }

        if (isset($options['phase']) && !empty($options['phase']))
        {
            foreach ($options['phase'] as $k => $v)
            {
                if (isset(self::$phases[$k]))
                {
                    self::$phases[$k] = $v[0] ? true : false;

                    if (self::$phaseOrbUse === 1)
                    {
                        self::$phaseOrbs[$k] = (float)$v[1];
                    }
                }
            }
        }

        if (isset($options['arabic']) && !empty($options['arabic']))
        {
            foreach ($options['arabic'] as $k => $v)
            {
                if (isset(self::$arabics[$k]))
                {
                    self::$arabics[$k] = $v[0] ? true : false;

                    if (self::$arabicOrbUse === 1)
                    {
                        self::$arabicOrbs[$k] = (float)$v[1];
                    }
                }
            }
        }

        if (isset($options['h_sys']))
        {
            $hsys = array_search($options['h_sys'], self::HOUSE_SYSTEMS);

            self::$hsys = $hsys === false ? 0 : $hsys;
        }

        if (isset($options['ecliptic']))
        {
            self::$ecliptic = (int)$options['ecliptic'];
        }

        if (isset($options['firdaria']))
        {
            self::$firdaria = (int)$options['firdaria'];
        }

        if (isset($options['profection_push_direction']))
        {
            self::$profection = (int)$options['profection_push_direction'];
        }

        if (isset($options['decanates']))
        {
            self::$decanates = (int)$options['decanates'];
        }

        if (isset($options['bound_type']))
        {
            self::$bound = (int)$options['bound_type'];
        }

        if (isset($options['ayanamsa']))
        {
            self::$ayanamsa = (int)$options['ayanamsa'];
        }

        return true;
    }

    /**
     * Configuration reload
     */
    public static function reload()
    {

    }

    /**
     * Load one configuration
     * @param mixed ...$name
     * @return array[bool|array]
     */
    public static function load(...$name)
    {
        $result = [];

        foreach ($name as $k => $v)
        {
            switch ($v)
            {
                case 'bound':
                    $result[$v] = self::BOUNDS[self::$bound];
                    break;
                case 'ayanamsa':
                    $result[$v] = self::$ayanamsa;
                    break;
                case 'hsys':
                    $result[$v] = self::HOUSE_SYSTEMS[self::$hsys];
                    break;
                case 'firdaria':
                    $result[$v] = self::FIRDARIA_MAIN_NIGHT[self::$firdaria];
                    break;
                case 'ecliptic':
                    $result[$v] = self::$ecliptic;
                    break;
                case 'profection':
                    $result[$v] = self::$profection;
                    break;
                case 'decanates':
                    $result[$v] = self::DECANATES[self::$decanates];
                    break;
                case 'planets':
                    $result[$v] = self::$planets;
                    break;
                case 'phases':
                    $result[$v] = self::$phases;
                    break;
                case 'arabics':
                    $result[$v] = self::$arabics;
                    break;
                case 'planetsOrb':
                    $result[$v] = self::$planetOrbs;
                    break;
                case 'phaseOrb':
                    $result[$v] = self::$phaseOrbs;
                    break;
                case 'arabicOrbs':
                    $result[$v] = self::$arabicOrbs;
                    break;
                default:
                    $result[$v] = false;
                    break;
            }
        }
        return $result;
    }
}
